package com.lebang.controller.api.oceanengine;

import com.alibaba.fastjson.JSONObject;
import com.lebang.model.back.QqapiModel;
import com.lebang.service.mongodb.QqApiModelMongodb;
import com.lebangweb.response.Callback;
import com.lebangweb.response.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;

/**
 * @Author: hwq
 * @Date: 2020/5/14 10:44
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/qq")
public class QqApi {
    @Autowired
    private QqApiModelMongodb qqApiModelMongodb;

    @GetMapping("/click")
    public JsonData click(HttpServletRequest request,String authorization_code ) {
          System.out.println(authorization_code);
        return Callback.success("success", "查询成功", null);
    }

    @GetMapping("/clickdata")
    public JSONObject info(HttpServletRequest request, /*String click_id, Long click_time, String advertiser_id,
                         String muid, String mac, String ip, String user_agent,
                         String app_type, String appid, String android_id, String oaid,*/ QqapiModel qqapiModel) {
        JSONObject jsonObject=new JSONObject();
        jsonObject.put("ret","0");
        jsonObject.put("msg","成功");
        qqapiModel.setCreatTime(LocalDateTime.now());
        qqapiModel.setStatus(0);
        qqApiModelMongodb.save(qqapiModel);
        return jsonObject;
    }

}
